{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. _nb_tnk:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## TNK\n",
    "\n",
    "Tanaka suggested the following two-variable problem:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Definition**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\\begin{equation}\n",
    "\\newcommand{\\boldx}{\\mathbf{x}}\n",
    "\\begin{array}\n",
    "\\mbox{Minimize} & f_1(\\boldx) = x_1, \\\\\n",
    "\\mbox{Minimize} & f_2(\\boldx) = x_2, \\\\\n",
    "\\mbox{subject to} & C_1(\\boldx) \\equiv x_1^2 + x_2^2 - 1 - \n",
    "0.1\\cos \\left(16\\arctan \\frac{x_1}{x_2}\\right) \\geq 0, \\\\\n",
    "& C_2(\\boldx) \\equiv (x_1-0.5)^2 + (x_2-0.5)^2 \\leq 0.5,\\\\\n",
    "& 0 \\leq x_1 \\leq \\pi, \\\\\n",
    "& 0 \\leq x_2 \\leq \\pi.\n",
    "\\end{array}\n",
    "\\end{equation}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Optimum**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Since $f_1=x_1$ and $f_2=x_2$, the feasible objective space is also\n",
    "the same as the feasible decision variable space. The unconstrained \n",
    "decision variable space consists of all solutions in the square\n",
    "$0\\leq (x_1,x_2)\\leq \\pi$. Thus, the only unconstrained Pareto-optimal \n",
    "solution is $x_1^{\\ast}=x_2^{\\ast}=0$. \n",
    "However, the inclusion of the first constraint makes this solution\n",
    "infeasible. The constrained Pareto-optimal solutions lie on the boundary\n",
    "of the first constraint. Since the constraint function is periodic and\n",
    "the second constraint function must also be satisfied,\n",
    "not all solutions on the boundary of the first constraint are Pareto-optimal. The \n",
    "Pareto-optimal set is disconnected.\n",
    "Since the Pareto-optimal\n",
    "solutions lie on a nonlinear constraint surface, an optimization\n",
    "algorithm may have difficulty in finding a good spread of solutions across\n",
    "all of the discontinuous Pareto-optimal sets."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Plot**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pymoo.problems import get_problem\n",
    "from pymoo.util.plotting import plot\n",
    "\n",
    "problem = get_problem(\"tnk\")\n",
    "plot(problem.pareto_front(), no_fill=True)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
